// pages/feedback/index.js
Page({
  data: {
    feedbackContent: '',
    contact: ''
  },

  onInputFeedback(e) {
    this.setData({
      feedbackContent: e.detail.value
    });
  },

  onInputContact(e) {
    this.setData({
      contact: e.detail.value
    });
  },

  submitFeedback() {
    const { feedbackContent, contact } = this.data;
    
    if (!feedbackContent.trim()) {
      wx.showToast({
        title: '请填写反馈内容',
        icon: 'none'
      });
      return;
    }

    // 这里可以调用后端接口提交反馈
    wx.showLoading({
      title: '提交中...',
    });

    // 模拟提交
    setTimeout(() => {
      wx.hideLoading();
      wx.showToast({
        title: '提交成功',
        icon: 'success'
      });
      
      // 清空表单
      this.setData({
        feedbackContent: '',
        contact: ''
      });
      
      // 返回上一页
      setTimeout(() => {
        wx.navigateBack();
      }, 1500);
    }, 1000);
  }
});